home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / 93win / data1.cab / DLL_Toolkit / Source / HTBToolbar / HTBToolbar.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2005-03-02  |  3.9 KB  |  121 lines

  1. // HTBToolbar.cpp : Defines the initialization routines for the DLL.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "HTBToolbar.h"
  6. #include "ToolBarDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. //
  15. //    Note!
  16. //
  17. //        If this DLL is dynamically linked against the MFC
  18. //        DLLs, any functions exported from this DLL which
  19. //        call into MFC must have the AFX_MANAGE_STATE macro
  20. //        added at the very beginning of the function.
  21. //
  22. //        For example:
  23. //
  24. //        extern "C" BOOL PASCAL EXPORT ExportedFunction()
  25. //        {
  26. //            AFX_MANAGE_STATE(AfxGetStaticModuleState());
  27. //            // normal function body here
  28. //        }
  29. //
  30. //        It is very important that this macro appear in each
  31. //        function, prior to any calls into MFC.  This means that
  32. //        it must appear as the first statement within the 
  33. //        function, even before any object variable declarations
  34. //        as their constructors may generate calls into the MFC
  35. //        DLL.
  36. //
  37. //        Please see MFC Technical Notes 33 and 58 for additional
  38. //        details.
  39. //
  40. ToolBarDlg * g_Dialog;
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CHTBToolbarApp
  43.  
  44. BEGIN_MESSAGE_MAP(CHTBToolbarApp, CWinApp)
  45.     //{{AFX_MSG_MAP(CHTBToolbarApp)
  46.         // NOTE - the ClassWizard will add and remove mapping macros here.
  47.         //    DO NOT EDIT what you see in these blocks of generated code!
  48.     //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50.  
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CHTBToolbarApp construction
  53.  
  54. CHTBToolbarApp::CHTBToolbarApp()
  55. {
  56.     // TODO: add construction code here,
  57.     // Place all significant initialization in InitInstance
  58. }
  59.  
  60. /////////////////////////////////////////////////////////////////////////////
  61. // The one and only CHTBToolbarApp object
  62.  
  63. CHTBToolbarApp theApp;
  64.  
  65.  
  66. /*************************************************************************
  67. **************************************************************************
  68. **                                                                        **
  69. **            Name:         MyDial                                         **
  70. **                                                                        **
  71. **            Parameters:  nToolbarNum                                    **
  72. **                                                                        **
  73. **            Description: This is the function that will be called from    **
  74. **                       HTBasic to use the Toolbar. There is an        **
  75. **                         Optional Paramter for future use, when more    **
  76. **                         than one toolbar is being used.                **
  77. **                                                                        **
  78. **                         Because HTBasic needs the called function to    **
  79. **                         return before it can continue execution, this    **
  80. **                         function simply creates a thread on a function    **
  81. **                         that will create and show the toolbar, then    **
  82. **                         returns                                        **
  83. **                                                                        **
  84. **                                                                        **
  85. **************************************************************************
  86. **************************************************************************/
  87. short Toolbar(short nToolbarNum = 0)
  88. {
  89.     // Begin a Thread for the toolbar
  90.     AfxBeginThread(ShowToolbar, &nToolbarNum);
  91.  
  92.     return TRUE;
  93. }
  94.  
  95.  
  96. /*************************************************************************
  97. **************************************************************************
  98. **                                                                        **
  99. **            Name:         ShowToolbar                                    **
  100. **                                                                        **
  101. **            Parameters:  pParam (Which toolbar to load)                    **
  102. **                                                                        **
  103. **            Description: This function is on a separate thread than        **
  104. **                         the main DLL function called by HTBasic. This    **
  105. **                         is done so that HTBasic can continue running    **
  106. **                         at the same time that the toolbar is in use    **
  107. **                                                                        **
  108. **                                                                        **
  109. **************************************************************************
  110. **************************************************************************/
  111. UINT ShowToolbar( LPVOID pParam )
  112. {
  113.     // Create a Dialog Object
  114.     g_Dialog = new ToolBarDlg();
  115.  
  116.     // Show the Dialog
  117.     g_Dialog->DoModal();
  118.     return 0;
  119. }
  120.  
  121.